<template>
  <div>
    <div v-for="i in setpaymet" :key="i.id">
      <van-panel :title="i.createTime" desc status="待付款">
        <div>
          <van-card
            num="1"
            :price="i.productList[0].shopPrice"
            :title="i.productList[0].name"
            :thumb="imgurl + i.productList[0].defaultImg"
          >
            <!-- <template #tags>
          <van-tag plain type="danger">标签</van-tag>
          <van-tag plain type="danger">标签</van-tag>
            </template>-->
            <template #footer>
              <van-button size="mini">立即支付</van-button>
            </template>
          </van-card>
        </div>
      </van-panel>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      setlist: null,
      //   订单最后
      setpaymet: [],
      setdata: null,
    };
  },
  methods: {
    get() {
      this.$post(this.url + "user/orders/list", {
        userId: this.$store.state.user.id,
        type: 0,
        paymentFlag: 1,
        // nowPage: 2,
      }).then((res) => {
        // console.log(res);
        if (res.errorCode == "0") {
          this.setlist = res.data.orderListData;
          for (const i of this.setlist) {
            this.$post(this.url + "user/orders/detail", {
              userId: this.$store.state.user.id,
              orderNum: i.orderNum,
            }).then((res1) => {
              // console.log(res1);
              if (res1.errorCode == "0") {
                this.setdata = res1.data.orderItemList;
                this.setdata.forEach((e) => {
                  e.createTime = i.createTime;
                });
                // this.setdata.createTime = i.createTime;
                this.setpaymet.push(...this.setdata);
              }
            });
          }
          console.log(this.setpaymet);
        }
      });
    },
  },
  created() {
 this.get();
  },
};
</script>

<style  scoped>
</style>